import { http } from "@/utils/http";
import { vapUrlApi } from "../utils";

export type AddShHost = {
  uid: string;
  hostName: string;
  ip: string;
  connPort: number;
  authType: number;
  username: string;
  password: string;
  remark: string;
};

export type SearchShHost = {
  ip: string;
  pageNum: number;
  pageSize: number;
};

export type VapShHost = {
  id: string;
  uid: string;
  hostName: string;
  ip: string;
  connPort: number;
  authType: number;
  username: string;
  password: string;
  remark: string;
  creator: string;
  creatorId: string;
  createdAt: number;
  updatedAt: number;
};
export type Result = {
  list: Array<any>;
  total?: number;
};
// 添加sh 主机
export const addHost = (data?: AddShHost) => {
  return http.request("post", vapUrlApi("shHost/add"), {
    data
  });
};

// 删除 sh 主机
export const deleteHost = (id?: string) => {
  return http.request("delete", vapUrlApi("shHost/delete/" + id));
};

// 分页 sh 主机
export const pageHost = (params?: SearchShHost) => {
  return http.request<Result>("get", vapUrlApi("shHost/page"), { params });
};
